<% @main_header = "#{link_to('Ptrack:', '/')} #{@project.name if @project}: Notes" %>

<style type="text/css">
  #notes-expanded h2{
    margin:0;
    padding:0;
  }
  #notes-expanded h2 a{
    border:medium none;
    color:#000000;
    font-family:"Lucida Grande",arial,sans-serif;
    font-size:14px;
  }
  #notes-expanded p{
    font-size:12px;
    line-height:1.4em;
    margin:3px 0 10px;
    padding:0;
  }
  #notes-expanded h3{
    color:#666666;
    font-family:"Lucida Grande",arial,sans-serif;
    font-size:12px;
    margin:20px 0 0;
    padding:0;
  }
  .notes-expanded-body{
    margin-bottom:20px;
    padding-bottom:5px;
    border-bottom:1px solid #CCC;
  }
</style>

<div id="info" class='column span-8' style="width: 100%;">
	<div style="width: 80%; float: left;">
		<h3><%= link_to "Create New Note", :action=> :new %></h3>
	</div>
	<div style="width: 20%; float: left; text-align: right;">
		<%= @viewType.nil? ? "List View" : link_to("List View", {:action => "index"}) %> |
		<%= (@viewType == "expanded") ? "Expanded View" : link_to( "Expanded View", {:action => "index", "view" => "expanded" } ) %>
	</div>
</div>
<div style="float: left; width: 100%;">
  <fieldset>

    <% unless @project %>
      <legend>All Notes</legend>
    <% else %>
      <legend>Project Notes</legend>
    <% end %>


    <div id="notes-expanded">
      <% for note in @notes %>
      <h2><%= link_to h(note.title), {:action => "show", :id => note } %></h2>
      <div class="notes-expanded-body">
        <p>
          <%= note.body.gsub(/\n/, '<br>') %>
        </p>
        <h3>
          Posted by <%= note.user.nil? ? "an anonymous user" : link_to( h(note.user.full_name), {:controller => "users", :action => "show", :id => note.user.id}) %>
          <!-- @todo: categories -->
          at <%=note.updated_at.strftime("%d.%m.%Y at %H:%M") %>
          <span class="pipe">|</span>
          <%= link_to "Edit", :action => "edit", :id => note%>
        </h3>
      </div>
      <% end %>
    </div>
    <div><%= link_to "See all notes", {:action => "index"} %>
  </fieldset>
</div>